var txt1 = document.querySelector('.txt1');
var txt2 = document.querySelector('.txt2');
var dj = document.querySelector('.dj');
var jt = document.querySelector('.jt');
var buer = true;
var data_zh = ['你知道吗', '六月', '一日', '星期一', '是', '儿童节'];
var data_en = ['do you know', 'June', 'One day', 'Monday', 'Yes', 'Children\'s day'];
var buer2='color2';
dj.onclick=function(){
	 for(var i=0;i<data_zh.length;i++){
	 	switch(txt1.value){
	 		case data_zh[i]:
		 		txt2.value=data_en[i];
		 		buer = false;
		 		buer2 = 'color2';
		 		bianse();
		 		break;
		 	case data_en[i]:
		 		txt2.value=data_zh[i];
		 		buer = false;
		 		buer2 = 'color1';
		 		bianse();
		 		break;
	 	}
	 }
	 if(buer){
	 	alert('无法翻译');
	 }
	 buer = true;
}
function bianse(){
	if (buer2=='color1') {
	 		spd1.setAttribute("class","sp11");
	 		spd3.setAttribute("class","sp11");
	 		spd2.setAttribute("class","sp10");
	 		spd4.setAttribute("class","sp10");

	 		buer2 = 'color2'
	}else {	
	 		spd2.setAttribute("class","sp11");
	 		spd4.setAttribute("class","sp11");
	 		spd1.setAttribute("class","sp10");
	 		spd3.setAttribute("class","sp10");
	 		buer2 = 'color1'
	}
}
function zw(a) {
	if (a) {
		buer2 = 'color1';
	}else{
		buer2 = 'color2';
	}
	bianse();
}
window.onload=function(){//用window的onload事件，窗体加载完毕的时候
   bianse();
}